# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-pytest-celery
#_pkgreal is used by apkbuild-pypi to find modules at PyPI
_pkgreal=pytest-celery
pkgver=1.0.0
pkgrel=0
pkgdesc="Official pytest plugin for Celery."
url="https://github.com/celery/pytest-celery"
arch="noarch"
license="BSD-3-Clause"
depends="
	py3-redis
	py3-python-memcached
	py3-pytest-docker-tools
	py3-retry
	py3-psutil
"
checkdepends="
	py3-celery
	py3-pytest
	py3-coverage
	py3-pytest-sugar
	py3-pytest-cov
	py3-pytest-xdist
	py3-pytest-subtests
	py3-pytest-rerunfailures
"
makedepends="
	poetry
	py3-setuptools
	py3-gpep517
	py3-wheel
"
options="!check" # requires docker and has circular dependency with py3-celery
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/celery/pytest-celery/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgreal-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer "$builddir"/.dist/*.whl
	.testenv/bin/python3 -m pytest -v
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
6bbcfa0134c4fa9dd42706c7a8d33e06875534acf9a976669f8f0acd3e4754a5177bb2ad123effd515dc68fc55b72b1d9902361687f4b9a81d9868ea02798500  py3-pytest-celery-1.0.0.tar.gz
"
